﻿using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using RAP.Framework.Libary.Configuration;
using System;
using System.Collections.Generic;
using System.Text;

namespace RAP.Web.Libary.AppStatup
{
  /// <summary>
  /// 服务启动入口对象接口
  /// </summary>
  public interface IStartupApp
  {
    /// <summary>
    /// 服务的本地跟路径
    /// </summary>
    string ServerRootPath { get; set; }

    /// <summary>
    /// 配置文件的根路径
    /// </summary>
    string ConfigPath { get; set; }

    /// <summary>
    /// 系统配置
    /// </summary>
    IConfiguration Configuration { get; }

    /// <summary>
    /// 站点配置对象的类型
    /// </summary>
    Type SiteSettingType { get; set; }

    /// <summary>
    /// 配置Http过滤器
    /// </summary>
    /// <param name="services"></param>
    void ConfigureFilters( IServiceCollection services );

    /// <summary>
    /// 配置Http Headers
    /// </summary>
    /// <param name="app"></param>
    /// <param name="services"></param>
    void ConfigureHttpHeaders( IApplicationBuilder app, IServiceProvider services );

    /// <summary>
    /// 配置日志
    /// </summary>
    /// <param name="app"></param>
    /// <param name="services"></param>
    /// <param name="loggerFactory"></param>
    /// <returns></returns>
    ILogger ConfigureLogger( IApplicationBuilder app, IServiceProvider services, ILoggerFactory loggerFactory );

    /// <summary>
    /// 调试WebApp
    /// </summary>
    /// <param name="configuration"></param>
    /// <returns></returns>
    bool DebugApp( IConfigurationManager configuration );
  }
}
